<html>
<head><meta charset="utf-8"><title>Semicolon tokens · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semicolon.20tokens.html">Semicolon tokens</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="231976499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semicolon%20tokens/near/231976499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semicolon.20tokens.html#231976499">(Mar 26 2021 at 14:44)</a>:</h4>
<p>It sounds weird, but trying to obtain a semicolon token of some nodes results in <code>None</code>, even if node does have a semicolon token in code. Am I missing something? <a href="/user_uploads/4715/lh0nGRR0Z7xo-bFzjr_pqlow/image.png">image.png</a> <a href="/user_uploads/4715/UPo-Kncj_vdkYVCcQzPN3cL0/image.png">image.png</a> <a href="/user_uploads/4715/vGfJRC9zBJaAMkree05ev_ev/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/lh0nGRR0Z7xo-bFzjr_pqlow/image.png" title="image.png"><img src="/user_uploads/4715/lh0nGRR0Z7xo-bFzjr_pqlow/image.png"></a></div><div class="message_inline_image"><a href="/user_uploads/4715/UPo-Kncj_vdkYVCcQzPN3cL0/image.png" title="image.png"><img src="/user_uploads/4715/UPo-Kncj_vdkYVCcQzPN3cL0/image.png"></a></div><div class="message_inline_image"><a href="/user_uploads/4715/vGfJRC9zBJaAMkree05ev_ev/image.png" title="image.png"><img src="/user_uploads/4715/vGfJRC9zBJaAMkree05ev_ev/image.png"></a></div>



<a name="231976609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semicolon%20tokens/near/231976609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semicolon.20tokens.html#231976609">(Mar 26 2021 at 14:45)</a>:</h4>
<p>Found something similar with match arms and commas after them while working on item movers</p>



<a name="231976869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semicolon%20tokens/near/231976869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semicolon.20tokens.html#231976869">(Mar 26 2021 at 14:46)</a>:</h4>
<p>your macro_call there is a MacroCall node, the semicolon doesn't belong to that node though</p>



<a name="231976894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semicolon%20tokens/near/231976894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semicolon.20tokens.html#231976894">(Mar 26 2021 at 14:46)</a>:</h4>
<p>it belongs to the parent which is a <code>ExprStmt</code></p>



<a name="231977015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semicolon%20tokens/near/231977015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semicolon.20tokens.html#231977015">(Mar 26 2021 at 14:47)</a>:</h4>
<p>Oh, my bad, should've looked at node tree <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="231977021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semicolon%20tokens/near/231977021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semicolon.20tokens.html#231977021">(Mar 26 2021 at 14:47)</a>:</h4>
<p>You'll need something like <code>macro_call.syntax().parent().and_then(ast::ExprStmt::cast).unwrap().semicolon_token()</code>(minus the unwrap later on ideally)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>